﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////


#pragma once
#include "GnufBase.h"
#include "GnufButtonEx.h"

namespace gnuf {
    class GNUF_BASE_EXPORT CheckButton final
        : public ButtonEx
    {
    public:
        static const EItemType Type;
        enum class CheckType
        {
            RadioBoxType,
            CheckBoxType
        };
        explicit CheckButton(Item*);
        virtual ~CheckButton() {}

    public:
        inline void setCheckType(CheckType val) { m_type = val; }
        inline CheckType checkType() const { return m_type; }

        void setCheckIconPath(const std::wstring& val);
        inline std::wstring checkIconPath() const { return m_checkIconPath; }

        void setCheck(bool val);
        inline bool isChecked() const { return m_bCheck; }

        // 只在Qt创建前设置有效， 默认为true
        inline void setHasIndicator(bool val) { m_hasIndicator = val; }
        inline bool hasIndicator() const { return m_hasIndicator; }
    protected:
        virtual void onChecked(bool) override;

    private:
        CheckType m_type;
        std::wstring m_checkIconPath;
        bool m_bCheck;
        bool m_hasIndicator;
    };
}
